import React,{useState,useEffect} from 'react'
import { Breadcrumb } from 'antd';
import { useLocation } from 'react-router-dom';
export default function Bread() {
  const{pathname}=useLocation()
  const [breadName,setBreadName]=useState('11')

  // console.log(pathname);
  useEffect(()=>{
    switch(pathname){
      case '/listlist':
        setBreadName('查看文章列表list');
        break;
        case '/listtable':
          setBreadName('查看文章列表table');
          break;
        case '/edit':
          setBreadName('文章编辑');
          break;
          case '/means':
            setBreadName('修改资料');
            break;
         default:
          setBreadName(pathname.includes('edit')?'文章编辑':'')
         break;

    }

  },[pathname])
  return (
    <Breadcrumb style={{height:'30px',background:'skyblue'}}>
    <Breadcrumb.Item href='/'>首页</Breadcrumb.Item>
    <Breadcrumb.Item >{breadName}</Breadcrumb.Item>
  </Breadcrumb>
  )
}
